<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>xiltimer: sleep.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">xiltimer
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('sleep_8h.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">sleep.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This header file contains sleep related APIs. </p>
<pre>
MODIFICATION HISTORY :</pre><pre>Ver   Who  Date  Changes
</p>
<hr/>
<p>
 1.0  adk        24/11/21 Initial release.
 1.2  adk        22/12/22 Fixed doxygen style and indentation issues.
 2.1  adk      11/09/24 Added missing prototype for <a class="el" href="group__xiltimer__api.html#ga5b18907cf69292caad8910f3667e48fd" title="This API gives delay in msec. ">msleep()</a> API.</pre><pre></pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ab3f37ae3880d8b5eacf85928293f2cee"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sleep_8h.html#ab3f37ae3880d8b5eacf85928293f2cee">Xil_poll_timeout</a>(IO_func, ADDR, VALUE, COND, TIMEOUT_US)</td></tr>
<tr class="memdesc:ab3f37ae3880d8b5eacf85928293f2cee"><td class="mdescLeft">&#160;</td><td class="mdescRight">This macro polls an address periodically until a condition is met or till the timeout occurs.  <a href="#ab3f37ae3880d8b5eacf85928293f2cee">More...</a><br/></td></tr>
<tr class="separator:ab3f37ae3880d8b5eacf85928293f2cee"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga068447b060a14715c07173bba411eb75"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xiltimer__api.html#ga068447b060a14715c07173bba411eb75">usleep</a> (unsigned long useconds)</td></tr>
<tr class="memdesc:ga068447b060a14715c07173bba411eb75"><td class="mdescLeft">&#160;</td><td class="mdescRight">This API gives delay in usec.  <a href="group__xiltimer__api.html#ga068447b060a14715c07173bba411eb75">More...</a><br/></td></tr>
<tr class="separator:ga068447b060a14715c07173bba411eb75"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5b18907cf69292caad8910f3667e48fd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xiltimer__api.html#ga5b18907cf69292caad8910f3667e48fd">msleep</a> (unsigned long mseconds)</td></tr>
<tr class="memdesc:ga5b18907cf69292caad8910f3667e48fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">This API gives delay in msec.  <a href="group__xiltimer__api.html#ga5b18907cf69292caad8910f3667e48fd">More...</a><br/></td></tr>
<tr class="separator:ga5b18907cf69292caad8910f3667e48fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafc060fb73e66e0f4493f7417ef6e4047"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xiltimer__api.html#gafc060fb73e66e0f4493f7417ef6e4047">sleep</a> (unsigned int seconds)</td></tr>
<tr class="memdesc:gafc060fb73e66e0f4493f7417ef6e4047"><td class="mdescLeft">&#160;</td><td class="mdescRight">This API gives delay in sec.  <a href="group__xiltimer__api.html#gafc060fb73e66e0f4493f7417ef6e4047">More...</a><br/></td></tr>
<tr class="separator:gafc060fb73e66e0f4493f7417ef6e4047"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ab3f37ae3880d8b5eacf85928293f2cee"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define Xil_poll_timeout</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">IO_func, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ADDR, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">VALUE, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">COND, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">TIMEOUT_US&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">( {       \</div>
<div class="line">        u64 timeout = TIMEOUT_US/100;    \</div>
<div class="line">        if(TIMEOUT_US%100!=0)   \</div>
<div class="line">                timeout++;   \</div>
<div class="line">        for(;;) { \</div>
<div class="line">                VALUE = IO_func(ADDR); \</div>
<div class="line">                if(COND) \</div>
<div class="line">                        break; \</div>
<div class="line">                else {    <a class="code" href="group__xiltimer__api.html#ga068447b060a14715c07173bba411eb75">\</a></div>
<div class="line"><a class="code" href="group__xiltimer__api.html#ga068447b060a14715c07173bba411eb75">			usleep</a>(100);  \</div>
<div class="line">                        timeout--; \</div>
<div class="line">                        if(timeout==0) \</div>
<div class="line">                        break;  \</div>
<div class="line">                }  \</div>
<div class="line">        }    \</div>
<div class="line">        (timeout&gt;0) ? 0 : -1;  \</div>
<div class="line"> }  )</div>
<div class="ttc" id="group__xiltimer__api_html_ga068447b060a14715c07173bba411eb75"><div class="ttname"><a href="group__xiltimer__api.html#ga068447b060a14715c07173bba411eb75">usleep</a></div><div class="ttdeci">void usleep(unsigned long useconds)</div><div class="ttdoc">This API gives delay in usec. </div><div class="ttdef"><b>Definition:</b> xiltimer.c:87</div></div>
</div><!-- fragment -->
<p>This macro polls an address periodically until a condition is met or till the timeout occurs. </p>
<p>The minimum timeout for calling this macro is 100us. If the timeout is less than 100us, it still waits for 100us. Also the unit for the timeout is 100us. If the timeout is not a multiple of 100us, it waits for a timeout of the next usec value which is a multiple of 100us.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IO_func</td><td>- accessor function to read the register contents. Depends on the register width. </td></tr>
    <tr><td class="paramname">ADDR</td><td>- Address to be polled </td></tr>
    <tr><td class="paramname">VALUE</td><td>- variable to read the value </td></tr>
    <tr><td class="paramname">COND</td><td>- Condition to checked (usually involves VALUE) </td></tr>
    <tr><td class="paramname">TIMEOUT_US</td><td>- timeout in micro seconds</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>0 - when the condition is met</li>
<li>1 - when the condition is not met till the timeout period</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>none </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
